<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<script>
		let arr = [1,2,3,4,5,6,7,8,9,10]

		console.log(arr.length)
		// console.log(arr[1])
		// console.log(arr[2])
		// console.log(arr[3])
		// console.log(arr[4])
		// console.log(arr[5])
		// console.log(arr[6])
		// console.log(arr[7])
		let r = 0
		for(let i=0;i<arr.length;i++){
			r+=arr[i]
			console.log(arr[i])
			console.log(arr[i]/arr.length)
		}
		console.log(r)
		function ands(arr) {
			let r = 0
			for(let i=0;i<arr.length;i++){
			r+=arr[i]
	
			// console.log(arr[i])
			// console.log(r/arr.length)

			
				}
		return r
		}
		console.log(ands([5,6,8,4,9]),'函数版')
		
		// 求当前数组中最大值和最小值
		let max = arr[0]
		for(let i=0;i<arr.length;i++){
			if(arr[i]>max){
				max=arr[i]
			}
		}
		console.log(max)
		// 冒泡排序

		let arr2 = [1,5,9,3,8,6]
		for(let i=0;i<arr2.length;i++){
			console.log('比较多少次',i+1)
			for(let j=0;j<arr2.length;j++){
				console.log('比较每次的结果',j+1,arr2)
				if(arr2[j]<arr2[j+1]){
					let temp =arr2[j]
					arr2[j]=arr2[j+1]
					arr2[j+1]=temp

				}
			}
		}
		console.log(arr2)
		let nums =7
		let arr4 = ['周天','周一','周二','周三','周四','周五','周六','周天']
		console.log(arr4[nums])
	</script>
</body>
</html>